package com.magenta.maxoptra.gis;

/**
 * Project: MaxOptra
 * User: kaganov
 * Date: 26.02.2009 12:20:27
 * <p/>
 * Copyright (c) 1999-2007 Magenta Corporation Ltd. All Rights Reserved.
 * Magenta Technology proprietary and confidential.
 * Use is subject to license terms.
 */
public class GeocodingKeyId {
    private String providerName;
    private String regionName;
    private boolean forRouting;

    public GeocodingKeyId(String providerName, String regionName, boolean forRouting) {
        this.providerName = providerName;
        this.regionName = regionName;
        this.forRouting = forRouting;
    }

    public String getProviderName() {
        return providerName;
    }

    public String getRegionName() {
        return regionName;
    }

    public boolean isForRouting() {
        return forRouting;
    }

    @Override
    public boolean equals(Object obj) {
        return obj != null && this.getClass() == obj.getClass() && ((GeocodingKeyId) obj).providerName.equals(providerName) &&
                ((GeocodingKeyId) obj).regionName.equals(regionName) && ((GeocodingKeyId) obj).forRouting == forRouting;
    }

    @Override
    public int hashCode() {
        return providerName.hashCode() * 37 * 37 + regionName.hashCode() * 37 + (forRouting ? 0 : 1);
    }
}
